package org.liuyunfeng.web;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;
import java.util.concurrent.*;

/**
 * @author: TanJingyu
 * @create: 2022-07-29 16:41
 **/
@RestController
@RequestMapping("/test")
public class TestController {

    @GetMapping
    public String test() throws InterruptedException {
        System.out.println("当前线程：" + Thread.currentThread().getId());
        TimeUnit.SECONDS.sleep(2);

        return "success...";
    }


    public static void main(String[] args) throws InterruptedException {
//        DelayQueue<Delayed> delayeds = new DelayQueue<>();
//        delayeds.add(new Delayed() {
//            @Override
//            public long getDelay(TimeUnit unit) {
//                return 10000000000L;
//            }
//
//            @Override
//            public int compareTo(Delayed o) {
//                return 0;
//            }
//        });
//
//        System.out.println(delayeds.take());


        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                int i = 1 / 0;
            }
        };

        runnable.run();
        System.out.println("到了");


//        System.out.println(TimeUnit.NANOSECONDS.toSeconds(10000000000L));

//        CountDownLatch countDownLatch = new CountDownLatch();
//        countDownLatch.countDown();
//        countDownLatch.await();

//        ArrayBlockingQueue arrayBlockingQueue = new ArrayBlockingQueue<>();
//        arrayBlockingQueue.put();
//        arrayBlockingQueue.add();
//        arrayBlockingQueue.take();


//        CopyOnWriteArrayList<Object> objects = new CopyOnWriteArrayList<>();
//        Iterator<Object> iterator = objects.iterator();
//        objects.remove()


//        Map<Object, Object> map = new LinkedHashMap<>();
//        map.put("name", "tanjingyuu");
//        map.put("age", "tanjingyuu");
//
//        map.get("name");
//
//        map.keySet();
    }
}

    